#!/usr/bin/env python
# -*- coding: utf-8 -*-

from fastapi import APIRouter
from fastapi import Depends
from models.crud import *


item_router = APIRouter()
from . import create_db



@item_router.post("/items/{uid}", response_model=ItemOut)
def create_item_by_user(uid: int, item: ItemModel, db:Session=Depends(create_db)):
    return create_item_by_user_method(db, uid, item)


@item_router.get("/items/{uid}", response_model=List[ItemOut])
def get_items_by_uid(uid: int, skip: int = 0, limit: int = 10, db: Session = Depends(create_db)):
    return get_items_by_uid_method(db, uid, skip, limit)


@item_router.get("/items", response_model=List[ItemOut])
def get_items(skip: int = 0, limit: int = 10, db: Session = Depends(create_db)):
    return get_items_method(db, skip, limit)